#include"processBar.h"
#include<unistd.h>

typedef void (*callback_t)(int);

void download(callback_t cb)
{
    int total = 1000;
    int curr = 0;
    while (curr <= total)
    {
        usleep(50000);
        
        int rate = curr * 100 / total;
        cb(rate);
        curr += 10;
    }
    printf("\n");
}

int main()
{
    printf("download 1：\n");
    download(processBar);
    initBar();
    printf("download 2：\n");
    download(processBar);
    initBar();
    printf("download 3：\n");
    download(processBar);
    initBar();
    printf("download 4：\n");
    download(processBar);
    initBar();
}

